//
//  YMStringSize.m
//  BLKC
//
//  Created by Mac on 2017/10/10.
//  Copyright © 2017年 Andrew. All rights reserved.
//

#import "YMStringSize.h"
#import <UIKit/UIKit.h>

@implementation YMStringSize


//label自适应宽高
+ (CGSize)ym_sizeWithText:(NSString *)text font:(UIFont *)font maxW:(CGFloat)maxW
{
    NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
    attrs[NSFontAttributeName] = font;
    CGSize maxSize = CGSizeMake(maxW, MAXFLOAT);
    return [text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;
}

@end
